<?php 
	require_once('lib/nusoap.php');
    function getdata(){
		 include("connect/connect.php");
		mysql_select_db("police",$c);
		mysql_query("set names utf8");
		//get min max of PK
		$sql="select min(pol_recid) as minpk,max(pol_recid) as maxpk from victim where senddscc = 0";
		$rs=mysql_query($sql);
		$result = mysql_fetch_array($rs);
		$minpk=$result["minpk"];
		$maxpk=$result["maxpk"];
		//end get min max of PK
		$sql = "select pol_recid,pol_evnid,pol_psid,prename,fname,sname,pid,sts from victim where pol_recid between '$minpk' and '$maxpk'";
		//echo $sql;
		$rs=mysql_query($sql);	
		$str_return="";
		//$str_return="pol_recid,pol_dte,pol_plcid,pol_tme,pol_des;";
		while ($result = mysql_fetch_array($rs)){		$str_return=$str_return.$result["pol_recid"].",".$result["pol_evnid"].",".$result["pol_psid"].",".$result["prename"].",".$result["fname"].",".$result["sname"].",".$result["pid"].",".$result["sts"].";";
		}
		$tempY=date("Y");
		if($tempY<"2550"){
			$tempY=(int)$tempY+543;
		}
		$datetime_send= $tempY.date("-m-d-H:i");
		$sql="update victim set senddscc=1,datetime_send='$datetime_send' where pol_recid between '$minpk' and '$maxpk'";
		//echo "<br>".$sql;
		$rs=mysql_query($sql);
		return $str_return;
	}

	function getPoliceVictim($name){ 
		return getdata();
	} 
 	$ws_server = new soap_server; 
$ws_server->configureWSDL('getPoliceVictimWSDL', 'http://localhost/dsccmis/datasource_webservice/');
 
$ws_server->register('getPoliceVictim',array('name'=>'xsd:string'),array('return'=>'xsd:string'),'http://localhost/dsccmis/datasource_webservice/','http://localhost/dsccmis/datasource_webservice','rpc','encoded','send policevictim');
// Use the request try to invoke the service 
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $ws_server->service($HTTP_RAW_POST_DATA); 
//echo getdata();
?> 
